/*
 * @Author: mikey.zhaopeng
 * @Date:   2016-06-04 16:31:55
 * @Last Modified by:   mikey.zhaopeng
 * @Last Modified time: 2016-07-13 16:16:08
 */


'use strict';
define([
    '../../../framework/base/baseView',
    'text!../tpl/adPreview/mobilefeed.html'
], function(
    BaseView,
    tpl
) {
    function me() {
        BaseView.apply(this, arguments);
        var self = this;
        this.init = function($root, preivewImg) {
            self.$root = $root;
            self.$preivewImg = null;
            self.preivewImg = preivewImg;
            self.render();
        }

        this.render = function() {
            self.$root.html(I18N.parse(tpl,'createMaterial'));
            self.$preivewImg = self.$root.find('.preview-img');
            // 判断是否是轮播广告（CA,LA）,判断是否是大图片 (>600)
            //var creativeType = "";
            //var creativeObj = Kit.getCache('copyModule', 'creativeType');
            //if(creativeObj != undefined){
            //    creativeType = creativeObj[0].categoryType;
            //}
            //if(creativeType == "CA"){
            //    //轮播广告
            //
            //}else{
            //
            //}
            var imgWidth = window.localStorage.getItem("previewImg-width");
            if(imgWidth > 600){
                self.$preivewImg.css({left: "12px",
                    width: "307px"
                    //,"background-image":'url(http://ec-image.clientgear.com/root/material_style/8/8.png)'
                });
            }
            console.log(self.preivewImg );
            self.$preivewImg.css("background-image",'url(' + self.preivewImg + ')')
            self.event();
        }

        this.event = function() {
            self.$root.find('.btn-next').off('click').on('click', $.proxy(self.submitStep1, self));
        }


        this.submitStep1 = function(e) {
            self.$root.trigger('enterStep2');
        }

    }
    return me;
});
